package com.sfac.service.impl;

import com.sfac.account.Resource;
import com.sfac.dao.ResourceDao;
import com.sfac.service.ResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
import java.util.Optional;

/**
 * @Description ResourceServiceImpl
 * @Author JiangHu
 * @Date 2022/7/11 9:48
 */
@Service
public class ResourceServiceImpl implements ResourceService {

	@Autowired
	private ResourceDao resourceDao;

	@Override
	public List<Resource> getResourcesByRoleId(int roleId) {
		return Optional
				.ofNullable(resourceDao.getResourcesByRoleId(roleId))
				.orElse(Collections.emptyList());
	}
}
